package com.zy;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.loadbalancer.annotation.LoadBalancerClient;
import org.springframework.cloud.loadbalancer.annotation.LoadBalancerClientConfiguration;
import org.springframework.cloud.loadbalancer.annotation.LoadBalancerClients;
import org.springframework.cloud.openfeign.EnableFeignClients;

@SpringBootApplication
@EnableDiscoveryClient
//配置不同的服务使用不同负载均衡器
@LoadBalancerClients(
        value={
                @LoadBalancerClient(name = "idGenerator", configuration = LoadBalancerClientConfiguration.class),
                @LoadBalancerClient(name = "fileUpload", configuration = LoadBalancerClientConfiguration.class)
        },
        defaultConfiguration = LoadBalancerClientConfiguration.class
)
@EnableFeignClients(basePackages= {"com.zy.restApi"})   //开启Feign客户端 -> 利用动态代理机制, 生成代理对象
public class UserApp
{
    public static void main( String[] args )
    {
        SpringApplication.run(   UserApp.class, args );
    }
}
